package kadledav.adventure.framework.controll.commands;

import java.io.PrintStream;
import java.util.List;
import java.util.Scanner;

import kadledav.adventure.framework.controll.ControllConstants;
import kadledav.adventure.framework.controll.commands.abstr.MoveItemCommand;
import kadledav.adventure.framework.model.world.Item;
import kadledav.adventure.framework.model.world.Player;

public class TakeCommand extends MoveItemCommand{

	public TakeCommand(PrintStream out, Scanner in, Player player) {
		super(out, in, player);
	}

	@Override
	protected void doTheCommand(Item item) {
	 	if(player.pickUpItem(item)){
				out.println("sebral jsem predmet: "+item.getName());
			}else{
				out.println("Nemohu sebrat predmet: "+item.getName());
		}
		out.println();
	}

	@Override
	protected String getCommadnPrefix() {
		return ControllConstants.LOCATION_ITEM_PREFIX;
	}

	@Override
	protected List<Item> getItemsSource() {
		return player.getCurrentLocation().getItems();
	}

}
